import { createRouter, createWebHashHistory } from 'vue-router'

// 路由规则配置
const routes = [
	{
		path: '/login',
		name: 'login',
		component: ()=>import('@/views/Login/index.vue')
	},
	{
		path: '/',
		name: 'home',
		component: ()=>import('@/views/Home/index.vue'),
	},
	{
		path: '/category',
		name: 'category',
		component: ()=>import('@/views/Category/index.vue')
	},
	{
		path: '/recommend',
		name: 'recommend',
		component: ()=>import('@/views/Recommend/index.vue')
	},
	{
		path: '/carts',
		name: 'carts',
		component: ()=>import('@/views/Carts/index.vue')
	},
	{
		path: '/user',
		name: 'user',
		component: ()=>import('@/views/user/index.vue')
	},
	{
		path: '/Product/:productId',
		name: 'Product',
		component: ()=>import('@/views/Product/index.vue'),
		props: true
	},
	{
		path: '/:pathMatch(.*)*',
		name: 'not-found',
		component:()=>import('@/views/NotFont/index.vue')
	}
]

// 创建router实例
const router = createRouter({
	history: createWebHashHistory(),
	routes
})

export default router